home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1438 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1000 b 

  1. Path: solaris.cc.vt.edu!usenet
  2. From: Ashutosh Gokhale <ashutosh>
  3. Newsgroups: comp.lang.c++
  4. Subject: Fastest way to index thru an array????
  5. Date: 10 Jan 1996 22:54:44 GMT
  6. Organization: Virginia Tech, Blacksburg, Virginia
  7. Message-ID: <4d1g3k$o09@solaris.cc.vt.edu>
  8. NNTP-Posting-Host: cadsta12.cadlab.vt.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. NNTP-Posting-User: ashutosh
  13. X-Mailer: Mozilla 1.1N (X11; I; AIX 2)
  14. X-URL: news:comp.lang.c++
  15.  
  16. Suppose I have an array A[][][] which I declare as
  17.     double ***A and then assign memory to it using new operator.
  18. Now consider that A has dimensions A[50][60][70]. Then I can index thru ALL
  19. entries of A using
  20. for(i=1; i<50; i++)
  21.  {
  22.    for(j=1; j<60; j++)
  23.     {
  24.       for(k=1; k<70; k++)
  25.        {
  26.          A[i][j][k] = <some expression>;
  27.        }
  28.     }
  29.  }
  30. But the above way is surely the most time-INEFFICIENT way.
  31. Can someone suggest me the MOST time efficient way of indexing through A[][][]?
  32.  
  33. Thanks a lot
  34.  
  35.